package receipe.pushing;

import java.io.File;

import org.dom4j.DocumentException;

public class Test {

	/**
	 *  We use this method to test filling from our xmls to attributes
	 *  form our own classes
	 */
	public static void main(String[] args) {
		
		RecipeAllDataToPush rd = new RecipeAllDataToPush();

		try {
			int i = 0;
			while (true) {
				File f = new File("recipesData" + (i) + ".xml");
				if (f.exists()) {
					rd.loadData(f);
					System.out.println(rd.toString());
					i++;

				} else {
					break;
				}
			}
			deleteFile();

		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void deleteFile() {
		try {
			int i = 0;
			while (true) {
				File file = new File("recipesData" + i + ".xml");
				if (file.delete()) {
					i++;
				} else {
					break;
				}
			}

		} catch (Exception e) {

			e.printStackTrace();

		}

	}
}
